home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_mysql.idb / usr / freeware / include / mysql / dbug.h.z / dbug.h
C/C++ Source or Header  |  2002-10-07  |  3KB  |  95 lines

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
  2.    
  3.    This library is free software; you can redistribute it and/or
  4.    modify it under the terms of the GNU Library General Public
  5.    License as published by the Free Software Foundation; either
  6.    version 2 of the License, or (at your option) any later version.
  7.    
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.    
  13.    You should have received a copy of the GNU Library General Public
  14.    License along with this library; if not, write to the Free
  15.    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  16.    MA 02111-1307, USA */
  17.  
  18. #ifndef _dbug_h
  19. #define _dbug_h
  20. #ifdef    __cplusplus
  21. extern "C" {
  22. #endif
  23. #if !defined(DBUG_OFF) && !defined(_lint)
  24. extern    int _db_on_,_no_db_;
  25. extern    FILE *_db_fp_;
  26. extern    char *_db_process_;
  27. extern    int _db_keyword_(const char *keyword);
  28. extern    void _db_setjmp_(void);
  29. extern    void _db_longjmp_(void);
  30. extern    void _db_push_(const char *control);
  31. extern    void _db_pop_(void);
  32. extern    void _db_enter_(const char *_func_,const char *_file_,uint _line_,
  33.             const char **_sfunc_,const char **_sfile_,
  34.             uint *_slevel_, char ***);
  35. extern    void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
  36.              uint *_slevel_);
  37. extern    void _db_pargs_(uint _line_,const char *keyword);
  38. extern    void _db_doprnt_ _VARARGS((const char *format,...));
  39. extern    void _db_dump_(uint _line_,const char *keyword,const char *memory,
  40.                uint length);
  41. extern    void _db_lock_file();
  42. extern    void _db_unlock_file();
  43.  
  44. #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
  45.     char **_db_framep_; \
  46.     _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
  47.             &_db_framep_)
  48. #define DBUG_LEAVE \
  49.     (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
  50. #define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
  51. #define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
  52. #define DBUG_EXECUTE(keyword,a1) \
  53.     {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
  54. #define DBUG_PRINT(keyword,arglist) \
  55.     {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
  56. #define DBUG_PUSH(a1) _db_push_ (a1)
  57. #define DBUG_POP() _db_pop_ ()
  58. #define DBUG_PROCESS(a1) (_db_process_ = a1)
  59. #define DBUG_FILE (_db_fp_)
  60. #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
  61. #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
  62. #define DBUG_DUMP(keyword,a1,a2)\
  63.     {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
  64. #define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
  65. #define DEBUGGER_OFF _no_db_=1;_db_on_=0;
  66. #define DEBUGGER_ON  _no_db_=0
  67. #define DBUG_LOCK_FILE { _db_lock_file(); }
  68. #define DBUG_UNLOCK_FILE { _db_unlock_file(); }
  69. #define DBUG_ASSERT(A) assert(A)
  70. #else                        /* No debugger */
  71.  
  72. #define DBUG_ENTER(a1)
  73. #define DBUG_RETURN(a1) return(a1)
  74. #define DBUG_VOID_RETURN return
  75. #define DBUG_EXECUTE(keyword,a1) {}
  76. #define DBUG_PRINT(keyword,arglist) {}
  77. #define DBUG_PUSH(a1) {}
  78. #define DBUG_POP() {}
  79. #define DBUG_PROCESS(a1) {}
  80. #define DBUG_FILE (stderr)
  81. #define DBUG_SETJMP setjmp
  82. #define DBUG_LONGJMP longjmp
  83. #define DBUG_DUMP(keyword,a1,a2) {}
  84. #define DBUG_IN_USE 0
  85. #define DEBUGGER_OFF
  86. #define DEBUGGER_ON
  87. #define DBUG_LOCK_FILE
  88. #define DBUG_UNLOCK_FILE
  89. #define DBUG_ASSERT(A) {}
  90. #endif
  91. #ifdef    __cplusplus
  92. }
  93. #endif
  94. #endif
  95.